Detection method, device, apparatus, and storage medium

ABSTRACT

A detection method includes obtaining a to-be-migrated model. The to-be-migrated model includes a memory feature set, and the memory feature set represents a feature vector set associated with an application scene corresponding to the to-be-migrated model. The method further includes performing a metric calculation on at least one piece of sample data of a target scene and the memory feature set to obtain at least one metric calculation result, and updating the memory feature set according to the at least one metric calculation result to obtain a target memory feature set. The target memory feature set represents a feature vector set associated with the target scene. The method further includes obtaining a target detection model by replacing the memory feature set of the to-be-migrated model with the target memory feature set.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims priority to Chinese Patent Application No.202111671950.3, filed on Dec. 31, 2021, the entire content of which isincorporated herein by reference.

TECHNICAL FIELD

The present disclosure relates to the computer software technology fieldand, more particularly, to a detection method, a detection device, adetection apparatus, and a storage medium.

BACKGROUND

In manufacturing processes, scene migration requirements of a trainingmodel often exist. When scene migration occurs, often, it is difficultto genennerate enough sample data for model training in a short periodof time in a new scene, and even if sample data exists, a large amountof data labeling and labeling verification need to be performed onsupervised training of the model, which is time consuming and laborintensive.

SUMMARY

Embodiments of the present disclosure provide a detection method. Themethod includes obtaining a to-be-migrated model. The to-be-migratedmodel includes a memory feature set, and the memory feature setrepresents a feature vector set associated with an application scenecorresponding to the to-be-migrated model. The method further includesperforming a metric calculation on at least one piece of sample data ofa target scene and the memory feature set to obtain at least one metriccalculation result and updating the memory feature set according to theat least one metric calculation result to obtain a target memory featureset. The target memory feature set represents a feature vector setassociated with the target scene. The method further includes obtaininga target detection model by replacing the memory feature set of theto-be-migrated model with the target memory feature set.

Embodiments of the present disclosure provide an electronic device,including a memory and a processor. The memory stores a computerprogram. The processor is coupled with the memory and, when the computerprogram is executed, configured to obtain a to-be-migrated model. Theto-be-migrated model includes a memory feature set, and the memoryfeature set represents a feature vector set associated with anapplication scene corresponding to the to-be-migrated model. Theprocessor is further configured to perform a metric calculation on atleast one piece of sample data of a target scene and the memory featureset to obtain at least one metric calculation result and update thememory feature set according to the at least one metric calculationresult to obtain a target memory feature set. The target memory featureset represents a feature vector set associated with the target scene.The processor is further configured to obtain a target detection modelby replacing the memory feature set of the to-be-migrated model with thetarget memory feature set.

Embodiments of the present disclosure provide a non-transitory computerstorage medium storing a computer program and, when executed by aprocessor, causes the processor to obtain a to-be-migrated model. Theto-be-migrated model includes a memory feature set, and the memoryfeature set represents a feature vector set associated with anapplication scene corresponding to the to-be-migrated model. Theprocessor is further configured to perform a metric calculation on atleast one piece of sample data of a target scene and the memory featureset to obtain at least one metric calculation result and update thememory feature set according to the at least one metric calculationresult to obtain a target memory feature set. The target memory featureset represents a feature vector set associated with the target scene.The processor is further configured to obtain a target detection modelby replacing the memory feature set of the to-be-migrated model with thetarget memory feature set.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates a schematic flowchart of a detection method accordingto embodiments of the present disclosure.

FIG. 2 illustrates a schematic flow structure of the detection methodaccording to embodiments of the present disclosure.

FIG. 3 illustrates a schematic structural diagram of a detection deviceaccording to embodiments of the present disclosure.

FIG. 4 illustrates a structural diagram showing hardware of anelectronic device according to embodiments of the present disclosure.

FIG. 5 illustrates a schematic structural diagram of an electronicdevice according to embodiments of the present disclosure.

DETAILED DESCRIPTION OF THE EMBODIMENTS

The technical solutions of embodiments of the present disclosure will bedescribed in detail below in connection with the accompanying drawingsof embodiments of the present disclosure. The specific embodimentsdescribed herein are only used to explain the related disclosure, butnot to limit the disclosure. In addition, to facilitate the description,only parts related to the relevant disclosure are shown in theaccompanying drawings.

Unless otherwise defined, all technical and scientific terms used herehave the same meaning as commonly understood by one of ordinary skill inthe art. The terms used here are only for the purpose of describingembodiments of the present disclosure and are not intended to limit thepresent disclosure.

In the following description, the phrase “some embodiments” includes asubset of all possible embodiments. “some embodiments” may include asame or a different subset of all possible embodiments, which can becombined with each other without conflict.

The term “first\second\third” in embodiments of the present disclosureis only used to distinguish similar objects and does not represent aspecific order of objects. With “first\second\third” in a permittedsituation, a specific order or sequence may be interchanged to enableembodiments of the disclosure described here to be implemented in asequence different from the sequence illustrated or described here.

In manufacturing processes, scene migration requirements of a modeloften exist (for example, the model may be moved from an old productionline to a new production line due to production expansion). When scenemigration occurs, often, it is difficult to genennerate enough sampledata for model training in a short period of time in a new scene, andeven if sample data exists, a large amount of data labeling and labelingverification need to be performed on supervised training of the model,which is time consuming and labor intensive. In many cases, in order toimprove the inference efficiency of the model, especially for a modeldeployed in a light edge device, the model may be pruned and quantizedbefore deployment. Thus, the model cannot be updated on the edge device.

Accordingly, embodiments of the present disclosure provide a detectionmethod. The method may include obtaining a to-be-migrated model. Theto-be-migrated model may include a memory feature set. The memoryfeature set may represent a feature vector set that is associated withan application scene corresponding to the to-be-migrated model. Themethod may further include performing a metric calculation on at least apiece of sample data of a target scene and the memory feature set toobtain at least one metric calculation result and updating the memoryfeature set according to the at least one metric calculation result toobtain a target memory feature set. The target memory feature set mayrepresent a feature vector set associated with the target scene. Themethod may further include replacing the memory feature set in theto-be-migrated model with the target memory feature set to obtain atarget detection model. Thus, when the to-be-migrated model is migratedto the target scene, based on the metric calculation between thefeatures, the memory feature set of the to-be-migrated model may beupdated and replaced by using the sample data of the target scene. Thus,the updated target memory feature set may be suitable for the targetscene, such that the to-be-migrated model may be updated and migratedwith relatively few sample data. An updating speed may be fast, and timeand labor cost may be saved. In addition, the method may be furthersuitable for the migration and update of the model that is pruned andquantized and have a wide application range.

Embodiments of the present disclosure may be described in detail belowin connection with the accompanying drawings.

In embodiments of the present disclosure, FIG. 1 illustrates a schematicflowchart of a detection method according to embodiments of the presentdisclosure. As shown in FIG. 1 , the method includes the followingprocesses.

At S101, a to-be-migrated model is obtained. The to-be-migrated modelincludes a memory feature set. The memory feature set represents afeature vector set associated with an application scene corresponding tothe to-be-migrated model.

The detection method of embodiments of the present disclosure may beapplied to a detection device or an electronic device integrated with anupdate device. The electronic device may include, for example, acomputer, a smartphone, a tablet, a laptop, a palmtop computer, apersonal digital assistant (PDA), a navigation device, a server, etc.,which is not limited by embodiments of the present disclosure.

The detection method of embodiments of the present disclosure may besuitable for the process of updating a small sample of a model on anedge device with weak computation power with relatively few trainingsamples. Therefore, the electronic device may also include an edgedevice such as an edge computation box. A central processing unit (CPU)of the edge device may include an advanced RISC machine (ARM) structure.If the edge device includes a graphics processing unit (GPU), the edgedevice may include a lightweight edge device such as Jetson NX.

Embodiments of the present disclosure may be applied to a modelmigration process. Migration may represent that the model may be updatedfrom one application scene to another application scene. The model mayrefer to a model for a target detection problem and may be configured todetect the target. The method of embodiments of the present disclosuremay be referred to as the detection method. In the subsequentdescription, implementation of embodiments of the present disclosure maybe described exemplarily by taking the model as the target detectionmodel and the detected object as a to-be-detected image for example.

The to-be-migrated model may represent the model before scene migrationis performed. Thus, the to-be-migrated model may include the memoryfeature set. The memory feature set in the to-be-migrated model mayrepresent the feature vector set that is associated with the applicationscene corresponding to the to-be-migrated model.

For example, if the application scene of the to-be-migrated model isscene A, the memory feature set may represent a feature vector set thatis associated with scene A. In some embodiments, in scene A, a detectiontarget of the to-be-migrated model may be target A. Then, the memoryfeature set may represent the feature vector set of target A. Thefeature vector here may mainly refer to a prototype vector of target A.That is, a memory feature may be a prototype vector set of a targetobject.

In some embodiments, the to-be-migrated model may include a memorymodule. The memory module may store a memory feature set. The method mayfurther include obtaining an initial training set, an initial trainingset including training samples corresponding to a plurality of tasks,performing model training according to the initial training set toestablish an initial model that includes the memory module, obtainingreal image data, and performing a model adjustment on the initial modelby using the real image data to obtain the to-be-migrated model.

For the to-be-migrated model, the model architecture may include amemory module. The memory module may be configured to store the memoryfeature set. In embodiments of the present disclosure, when the methodis applied to the edge device, since the computation power of the edgedevice is weak, performing training on a large number of trainingsamples may cause excessive memory usage. Therefore, when the initialmodel is trained, multi-task model training may be performed on thecloud device to create the initial model including the memory module.

In embodiments of the present disclosure, the migration update of theto-be-migrated model may be realized based on the replacement of thememory feature set. Thus, the initial model obtained by performingpre-training with multiple tasks may need to be configured to realizethe scene adaptation during the model migration process.

When the initial model is obtained by performing the model trainingusing the initial training set, the initial training set may includetraining samples corresponding to several tasks. The several tasks mayinclude a plurality of tasks that are similar to the target tasks of theto-be-migrated model. The initial training set may usually include manytraining samples. Thus, the detection result of the initial model may bemore accurate. The multi-task model training process may be ameta-learning process. The initial model including a memory module maybe established by training the multi-task model.

In the process of performing training on the multi-task model, thedetection result of the model may be determined by using a full metricdecoding mechanism. That is, for the initial model, the to-be-migratedmodel and the target detection model that are obtained by updating theinitial model, the detection result of the model may be only related tothe metric calculation result and may not depend on the input trainingsample or the to-be-detected image.

In some embodiments, the initial model may include an encoder, a memorymodule, and a decoder. The encoder may be configured to perform featureextraction on a training sample (such as a sample image) to obtain depthfeature information of the training sample. The memory module may storea memory feature set corresponding to each task. The metric calculationmay be performed on each piece of depth feature information of thetraining sample and each feature vector in the memory feature set of thecorresponding task. Thus, a metric calculation result of each piece ofdepth feature information of the training sample and the correspondingfeature vector in the memory feature set may be obtained. The obtainedmetric calculation result may be input to the decoder. The detectionresult may be obtained by performing decoding by the decoder. Thedetection result may be compared to a real result that is marked inadvance. Iterative operations may be performed based on a loss functionuntil the initial model is obtained. That is, when the initial model istrained at the cloud end, the training may be mainly performed on thedecoder of the model to obtain an accurate detection result.

For the metric calculation of the depth feature information and thefeature vector in the memory feature set, for example, the memoryfeature set may include feature vector 1, feature vector 2, and featurevector 3, then when the feature extraction is performed on the trainingsamples, the obtained depth feature information may include depthfeature 1′, depth feature 2′, and depth feature 3′. Depth feature 1′ isthe depth feature information of corresponding feature vector 1 in thetraining sample, depth feature 2′ is the depth feature information ofcorresponding feature vector 2 in the training sample, and depth feature3′ is the depth feature information of corresponding feature vector 3 inthe training sample. When the metric calculation is performed, themetric calculation results of feature vector 1 and depth feature 1′,feature vector 2 and depth feature 2′, and feature vector 3 and depthfeature 3′, respectively, to obtain three metric calculation results.The three metric calculation results may be input to the decoder toperform decoding.

After the initial model is obtained, since the memory feature set storedin the memory module corresponds to the memory feature set of severaltasks, these tasks may not adapt to the target task when the model isactually used. Therefore, the memory feature set of the initial modelmay be cleared. Then, a corresponding memory feature set may begenerated based on the real application scene of the model.

The initial model may be deployed on the edge device, and the initialmodel may be fine-tuned based on real image data to obtain theto-be-migrated model. The real image data may include sample image dataof the real application scene corresponding to the model when the modelis deployed on the edge device. Performing fine-tuning on the model mayinclude generating the memory feature set of the current realapplication scene and storing the memory feature set into the memorymodule of the model.

In some embodiments, generating the memory feature set may includeextracting the feature vector of the target object that needs to bedetected from each piece of real image data and averaging all real imagedata for each feature vector to obtain an average of each featurevector. The average of the feature vector may be also referred to as aprototype vector. Averages of feature vectors may form the memoryfeature set of the real application scene. The feature vector set of theseveral tasks may be also determined in this manner.

In summary, for n pieces of real image data, if the feature vector ofthe target object includes at least vector A, then for vector A, thefeature vector corresponding to vector A may be extracted from eachpiece of real image data, that is, n feature vectors corresponding tovector A. An average of the n feature vectors may be calculated toobtain vector A in the memory feature set.

At S102, the metric calculation is performed on at least one piece ofsample data of the target scene and the memory feature set to obtain atleast one metric calculation result.

At S103, the memory feature set is updated according to the at least onemetric calculation result to obtain the target memory feature set. Thetarget memory feature set represents a feature vector set that isassociated with the target scene.

The at least one piece of sample data of the target scene may be asample data set used to update the to-be-migrated model. The metriccalculation may be performed on the at least one piece of sample data ofthe target scene and the memory feature set to obtain the metriccalculation result of the at least one piece of sample data and thememory feature set. The memory feature set may be updated according tothe obtained metric calculation result to obtain the target memoryfeature set. Then, the target memory feature set may be the featurevector set that is associated with the target scene.

For example, the target scene may be scene B. Thus, the memory featureset may represent the feature vector set that is associated with sceneB. In some embodiments, in scene B, the detection target of theto-be-migrated model may be target B. Thus, the memory feature set mayrepresent the feature vector set of target B. The feature vector heremay mainly refer to the prototype vector of target B.

For the sample data, in some embodiments, before performing the metriccalculation on the at least one piece of sample data of the target sceneand the memory feature set, the method may further include determiningthe target scene, obtaining at least one piece of initial sample data ofthe target scene according to the target scene, and performing labelingprocessing on the at least one piece of initial sample data to obtainthe at least one piece of sample data of the target scene.

When the sample data of the target scene is determined, the at least onepiece of initial sample data of the target scene may be obtained basedon the target scene. Then, the initial sample data can be labeled. Forexample, the initial sample data is an image. Labeling may be performedon a type or frame of the target object in the image to obtain thesample data. Therefore, when the metric calculation is performed, depthfeature information may be accurately extracted from the sample data. Inaddition, if back-propagation training is performed on theto-be-migrated model, supervised training and updating may also beperformed on the to-be-migrated model according to the labeled sampledata.

The metric calculation may include but is not limited to Euclideandistance calculation, Mahalanobis distance calculation, Manhattandistance calculation, Minkowski distance calculation, Hamming distancecalculation, Jaccard correlation coefficient calculation, Cosinesimilarity calculation, Chebyshev distance calculation, or PearsonCorrelation calculation. Since the metric calculation may usually be adistance calculation between two individuals, the metric calculationresult may also be referred as a distance value.

A similarity degree between the individuals may be determined by themetric calculation. In some embodiments, the smaller the value of themetric calculation result is, the higher the similarity degree betweenthe individuals is. The larger the value of the metric calculationresult is, the greater the difference between the individuals is.

Performing the metric calculation on the at least one piece of sampledata of the target scene and the memory feature set may include for eachpiece of sample data (taking an image as an example), first performingthe feature extraction on each piece of sample data to obtain at leastone piece of depth feature information of each piece of sample data, forany piece of depth feature information, obtaining the average depthfeature information by performing an average calculation on the depthfeature information of all the sample data, and performing the metriccalculation on the feature vector corresponding to the average depthfeature information in the memory feature set and the average depthfeature information to obtain the metric calculation result. For thefeature vector with the metric calculation result greater than a metricthreshold, the feature vector may be updated by using the depth featureinformation. For example, the feature vector may be replaced using theaverage depth feature information. For the metric calculation result notgreater than the feature vector of the metric threshold, the featurevector may not need to be updated. Thus, the metric threshold may be athreshold value used to represent a magnitude of the difference betweenthe two individuals.

Performing the metric calculation on the at least one piece of sampledata of the target scene and the memory feature set may also includefirst performing the feature extraction on the at least one piece ofsample data to obtain several pieces of depth feature information andperforming the metric calculation on the depth feature information witheach feature vector of the memory feature set to obtain metriccalculation results of the depth feature information with each featurevector of the memory feature set, and using a smallest metric result asthe metric calculation result of the depth feature information with thememory feature set.

Thus, for each piece of depth feature information, the metriccalculation result of the depth feature information with the memoryfeature set may be obtained. Then, the average may be calculated for themetric calculation results. The average may represent a differencedegree between the sample data set having at least one piece of sampledata and the memory feature set. When the average is big, the differencedegree between the sample set and the memory feature set may be big.That is, the target scene may have a large difference with the scene ofthe to-be-migrated model. When the average is small, the differencedegree between the sample set and the memory feature set may be small.That is, the target scene may have a small difference with the scene ofthe to-be-migrated model.

Thus, a metric threshold may still be set. The metric threshold may be athreshold used to represent the difference degree between the twoscenes. If the average is greater than the metric threshold, thedifference between the target scene and the scene of the to-be-migratedmodel may be big. Thus, a new targe memory feature set may be generatedbased on the sample data. If the average is not greater than the metricthreshold, the difference between the target scene and the scene of theto-be-migrated model may be small. Thus, the memory feature set may needto be partially updated. For example, features with the metriccalculation results greater than the metric threshold may be updated.

That is, the metric calculation may be performed on the at least onepiece of sample data of the target scene with the memory feature set toobtain the at least one metric calculation result. The similarity degreebetween the target scene and the application scene of the to-be-migratedmodel may be determined by the at least one metric calculation result.If the similarity degree is high, a part of the feature vectors in thememory feature set may need to be updated, and the other part of thefeature vectors may remain the same as the feature vectors in theoriginal memory feature set. If the similarity degree is low, the newtarget memory feature set may be generated to perform incrementallearning.

A determination manner of the metric calculation result may include theabove two manners. In addition, for those skilled in the art, thesimilarity degree between the application scene of the to-be-migratedmodel and the target scene may be determined in anther manner todetermine the target memory feature set, which is not described indetail here.

In some embodiments, a simple example is used to illustrate the targetscene and the application scene of the to-be-migrated model and theupdate of the memory feature set. If the to-be-migrated model is atarget detection model for a red apple. That is, the application sceneof the to-be-migrated model may include a scene of performing detectionon fruit of a to-be-detected image to determine whether the fruit in theto-be-detected image is a red apple and/or determine that the red appleis in an edge frame of the to-be-detected image. Then, the memoryfeature set may represent a feature vector set of the red apple. Thatis, a prototype vector of the red apple. If the target scene includes ascene of determining whether the fruit in the to-be-detected image is agreen apple and/or determining that the green apple is in the edge frameof the green apple in the to-be-detected image. Thus, the red apple andthe green apple may be determined to have a high similarity after themetric calculation. Therefore, a part of the feature vectors in thememory feature set may need to be updated, and the other part of thefeature vectors may remain unchanged to obtain the target memory featureset. If the target scene includes a scene of determining whether thefruit in the to-be-detected image is a banana and/or determining thatthe banana is in the edge frame of the to-be-detected image. Thus, afterthe metric calculation, the red apple and the banana may be determinedto have low similarity. Therefore, a new target memory feature set maybe generated based on sample data of the banana.

In addition, for some scenes that are simple, and the similarity degreeis easy to be determined by people, an update degree of the memoryfeature set may be determined by a development engineer without based onthe metric calculation result to determine the target feature set.

At S104, the target detection model is obtained by replacing the memoryfeature set of the to-be-migrated model with the target memory featureset.

After the target memory feature set is obtained, the memory feature setin the to-be-migrated model may be replaced with the target memoryfeature set. The model obtained after the replacement may be the targetdetection model. Thus, the migration and update of the to-be-migratedmodel may be completed. In addition, after the target detection model isobtained, if model migration is required later, the target detectionmodel may be used as the to-be-migrated model, and the migration updateof the to-be-migrated model may be implemented as described above.

In some embodiments, if the to-be-migrated model is a model withoutpruning and quantization processing, the method may further includeperforming data expansion on the at least one piece of sample data ofthe target scene to obtain an expanded data set and performingbackpropagation training on the to-be-migrated model using the expansiondata set to update model parameters of the to-be-migrated model exceptthe memory feature set.

If the to-be-migrated model is a model after the pruning andquantization processing, unimportant channels in the model may bedeleted, and a weight and an offset represented by a floating-pointnumber in the model may be approximated using low-precision integers.Thus, the model may occupy less memory, and the calculation speed may befaster. However, the model at this time may be no longer suitable forcalculating a parameter gradient. Thus, the to-be-migrated model withthe pruning and quantization processing may be updated in the manner ofreplacing the memory feature set of embodiments of the presentdisclosure.

For the to-be-migrated model without the pruning and quantizationprocessing, in addition to updating the memory feature set, theto-be-migrated model may be iteratively updated in a backpropagationtraining manner to update other parameters of the to-be-migrated model,such as a network weight.

When an amount of the at least one piece of sample data of the targetscene is small, the backpropagation training may cause overfitting ofthe model. Therefore, data expansion may be performed on the sample dataof the target scene to obtain a large amount of sample data to form theexpanded data set. The back-propagation training may be performed on theto-be-migrated model using the expansion data set to perform iterativeupdating to update the other model parameters of the to-be-migratedmodel.

A data expansion manner may include, for example, performing mirrorprocessing, rotation processing (e.g., rotating the sample image by acertain angle), scale transformation processing (e.g., changing theresolution of the image), and extraction processing (e.g., extracting apart of the sample image as a new sample image), and color dithering(e.g., adding a slight noise) processing on the sample data (such as asample image).

Thus, the memory module may be updated in the obtained target detectionmodel, and the other parameters may be also updated. That is, if thebackpropagation training is not involved, when the to-be-migrated modelis updated in embodiments of the present disclosure, the memory modulemay be mainly updated. Thus, the update speed may be faster, the updatemay be completed without a large amount of sample data.

Further, when the detection is performed on the to-be-detected imageusing the target detection model, in some embodiments, the method mayfurther include obtaining the to-be-detected image, performing themetric calculation on the to-be-detected image and the target memoryfeature set using the target detection model to obtain the target metriccalculation result, and determining the target detection resultaccording to the target metric calculation result. The target memoryfeature set may include at least one piece of memory featureinformation.

For example, a to-be-detected object may be the to-be-detected image,when the detection is performed on the to-be-detected image when theto-be-detected image is detected after the to-be-detected image isobtained, the to-be-detected image may be input into the targetdetection model to perform the metric calculation on the to-be-detectedimage and the target memory feature set to obtain the target metriccalculation result. The target detection result may be determinedaccording to the target metric calculation result.

Further, in some embodiments, performing the metric calculation on theto-be-detected image and the target memory feature set by the targetdetection model to obtain the target metric calculation result mayinclude performing the feature extraction on the to-be-detected image toobtain the at least one piece of depth feature information andperforming the metric calculation on the at least one piece of depthfeature information and the at least one piece of memory featureinformation.

The target feature set may include at least one piece of memory featureinformation. The memory feature information may be the feature vectorthat is associated with the target scene, that is the prototype vectorof the target object that needs to be detected in the target scene.

Performing the metric calculation on the to-be-detected image and thetarget memory feature may mainly refer to performing the metriccalculation on the depth feature information and the memory featureinformation of the to-be-detected image. Thus, the feature extractionmay be performed first on the to-be-detected image. An encoder in thetarget detection model may be configured to perform the featureextraction on the to-be-detected object to obtain the at least one pieceof depth feature information. The at least one piece of depth featureinformation may be mainly the part of feature information correspondingto the at least one piece of feature information in the to-be-detectedimage.

The metric calculation may be performed in a one-to-one correspondencebetween the at least one piece of depth feature information and the atleast one piece of memory feature information to obtain at least onemetric calculation result, that is the target metric calculation result.

After the target metric calculation result is obtained, the targetdetection result may be determined according to the target metriccalculation result.

In some embodiments, determining the target detection result accordingto the target metric calculation result may include performing decodingprocessing on the target metric calculation result to obtain the targetdetection result of the to-be-detected image.

When the target detection result is determined, the decoding processingmay be performed on the target metric calculation result. A decoder ofthe target detection result may be configured to perform the decodingprocessing on the target metric calculation result to obtain the targetdetection result. For example, the target metric calculation result maybe decoded to obtain the type of the target object or label an area ofthe edge frame where the target object of the to-be-detected image islocated.

Embodiments of the present disclosure provide a detection method. Themethod may include obtaining the to-be-migrated model. Theto-be-migrated model may include the memory feature set. The memoryfeature set may represent the feature vector set that is associated withthe application scene corresponding to the to-be-migrated model. Themethod may further include performing the metric calculation on the atleast one piece of sample data of the target scene with the memoryfeature set to obtain the at least one metric calculation result andupdating the memory feature set according to the at least one metriccalculation result to obtain the target memory feature set. The targetmemory feature set may represent the feature vector set that isassociated with the target scene. The method may further includereplacing the memory feature set in the to-be-migrated model with thetarget memory feature set to obtain the target detection model. Thus,since performing the target detection using the model includesperforming decoding on the metric calculation result between theto-be-detected image and the memory feature set to determine thedetection result, the detection result may be only related to the metriccalculation result and may not depend on the depth feature informationof the to-be-detected image. Thus, when the migration update isperformed on the model, a small amount of sample data of the targetscene may be used to obtain the target memory feature set to replace thememory feature set of the memory module. The decoder of the model maynot need to be trained again. Thus, on an aspect, for a new scene with asmall amount of training samples, a small sample migration update may berealized for the model. On another aspect, since the update of thememory feature set is a replacement process of the prototype vector, themigration update of the model may be realized by replacing the memoryfeature set of the memory module. Thus, during the migration updateprocess of the model, a large amount of iterative calculation may not beneeded. The adaptation and update may be completed in a short time(e.g., several minutes), which saves time and labor cost. On anotheraspect, since the model detection process based on the metriccalculation results is a forward inference process and does not rely onback propagation, a loss function may not need to be created, and agradient may not need to be calculated when the migration update of themodel is performed. The migration update may also be performed on themodel after the quantization.

In some other embodiments of the present disclosure, FIG. 2 illustratesa schematic flow structure of the detection method according toembodiments of the present disclosure. As shown in FIG. 2 , the flowstructure mainly includes a cloud-side preparation phase 201, an edgedeployment phase 202, and a new scene migration phase 203.

In the cloud-side preparation phase 201, meta-learning is performedmainly based on training samples of a relevant task group to constructan initial model based on the “memory module.” In the edge deploymentphase 202, fine-tuning may be performed on the initial model mainlybased on business data of the application scene of the edge device toobtain the corresponding detection model. In the new scene migrationphase 203, the migration and update of the model may be performed basedon business data of a new scene when the edge device switches scenes toobtain the detection model corresponding to the new scene.

As shown in FIG. 2 , in embodiments of the present disclosure, a smallsample update of the model may be implemented based on multi-task metriclearning. The detection model may include an encoder, a decoder, and amemory module. When the target detection is performed, the forwardinference of the model may be used. That is, an inference principle andan inference process of the detection model may include the followingprocesses.

(1) The to-be-detected image is input into the encoder, and the depthfeature information of the to-be-detected image is obtained through theencoder.

(2) The metric calculation is performed on the depth feature informationof the to-be-detected image and the memory feature information of thememory module to obtain the metric calculation result.

(3) The metric calculation result is input into the decoder for decodingto obtain the detection result.

For such a detection model based on “encoder-decoder-memory module,”multi-task pre-training may be used to create the initial model. Thus,the detection model may be updated by updating the memory feature set ofthe memory module to realize the adaption of the scene.

Relevant processes in the cloud-side preparation phase 201 may beusually performed on a cloud device. In the cloud-side preparation phase201, the encoder and the decoder of the model may be trained to causethe model to perform the feature extraction on the input image andperform decoding according to the metric calculation result to obtainthe detection result.

In some embodiments, on the cloud device, the meta-learning may beperformed based on training samples of the related task group to createthe initial model based on the “memory module.” The relevant task groupmay include a plurality of tasks that are similar to the target task andhave a large amount of training samples. The relevant task group may bedetermined by the model development staff, for example, task 1, task 2,..., task n shown in FIG. 2 . The target task may represent a specifictask corresponding to a practical application process of the model.

For example, the target task may be a target detection type task. Forexample, the target task may be a detection task for animal A. Thus,whether the animal in the image is animal A may need to be determined,and/or an area where animal A is located in the image may beframe-selected. The relevant task group may include detection tasks ofanimal B, animal C, animal D, and animal E. the memory module may storememory feature sets of animal B, animal C, animal D, and animal E. Themeta-learning may be performed by using animal B, animal C, animal D,and animal E as the training samples to obtain the initial model.

In embodiments of the present disclosure, the meta-learning process maybe referred to as a multi-task full-metric learning process. Multi-taskmay represent that the training samples used to train the initial modelare from the relevant task groups similar to the target task. The amountof the training samples in the relevant task group may be relativelylarge. The full-metric learning may represent that the obtaineddetection result may be related to the metric calculation result betweenthe depth feature information of the input image and the memory featureinformation for the decoder of the model and may no longer depend on theoriginal depth feature information of the input image.

In the multi-task full-metric learning process, first, the sample imageof the relevant task group may be input into the decoder. Decoding maybe performed by the decoder to obtain the depth feature information ofthe sample image. In some embodiments, the depth feature information ofthe sample image may include some features corresponding to the memoryfeature information in the memory module. Then, for each piece ofdecoded depth feature information, the metric calculation may beperformed on each piece of decoded depth feature information with thecorresponding memory feature information in the memory module to obtainthe metric calculation result corresponding to each depth featureinformation. Then, the metric calculation result may be input into thedecoder for decoding to obtain the detection result. The detectionresult may be compared with the real detection result of the sampleimage. The detection precision currently achieved by the model may bedetermined according to the comparison result. The next sample image maycontinue to be input to iteratively perform the process until thedetection precision of the model reached the predetermined precision.When the detection precision of the model is determined, a loss functionmay be set. When a value of the loss function is smaller than thepredetermined value, the detection precision of the model may bedetermined to reach the predetermined precision to obtain the initialmodel. In some other embodiments, when a number of iterations of themodel reach a predetermined value, the initial model may be determinedto be obtained.

The memory feature set stored in the memory module of the initial modelmay correspond to the application scene of the relevant task group andmay not necessarily correspond to the application scene of the model inthe edge device. Thus, the memory module may be cleared. That is, theinitial model having the memory module may be obtained. However, thememory features in the memory module may need to be determined when themodel is deployed at the edge device.

After the initial model is obtained, the fine-tuning may be performed onthe initial model at the edge device to obtain the detection model thatsatisfies the application scene of the edge device. Performing thefine-tuning on the initial model may include determining the memoryfeature set based on the current application scene of the edge device toupdate the memory module.

For example, as shown in FIG. 2 , models are deployed on a plurality ofedge devices. For new task A, based on sample data of new task A, aforward inference may be performed on the initial model to determine thememory feature set corresponding to the application scene of new task A.The corresponding memory feature set may be stored in the memory module.For new task B, similar processes may be performed.

Thus, when the target detection is performed by the model, the depthfeature of the to-be-detected image may be obtained by the encoder. Themetric calculation may be performed on the depth feature information andthe memory feature information of the memory feature set to obtain themetric calculation result. After the metric calculation result is inputto the decoder, the decoding may be performed by the decoder to obtainthe detection result.

The edge device usually may have small computation power and limitedstorage space. In some embodiments, in the edge deployment phase 202,pruning and quantization may be performed on the fine-tuned model. Bydeleting some unnecessary channels or unimportant connections in themodel, quantizing the weight of the model, and sharing the weight, thememory usage of the model may be reduced without sacrificing thedetection precision of the model. The model corresponding to new task Amay be recorded as detection model A, and the model corresponding to newtask B may be recorded as detection model B.

Further, after detection model A is successfully deployed on the edgedevice, the application scene of the model may be switched as needed.For example, a new detection task may be performed by the model, or themodel may be migrated to another edge device. Based on the updatemethod, the memory module of detection model A may be updated by usingthe sample data of new task C to obtain detection model C.

If detection model A is a model that has been pruned and quantized, onlythe memory module may be updated. If detection model A has not beenpruned and quantized, the backpropagation may also be used to updateother parameters of the model.

When the backpropagation method is used to update the model, since theamount of sample data for the new task is usually small, the smallamount of sample data of the new task may be expanded by using the dataexpansion method to realize iterative training and update of the model.

Thus, the detection method of embodiments of the present disclosuremainly includes the following processes.

(1) In the cloud-side preparation phase, based on the training sampledata of related task group, meta-learning is performed to create theinitial model based on the “memory module.”

(2) In the edge deployment phase, the fine-tuning is performed on theinitial model based on the business data (e.g., after the fine-tuning,pruning and quantization are performed on the model). The “memorymodule” of the task may be obtained through the forward inference andstored.

(3) In the new scene migration phase, when scene switching is performed,a small amount of new scene data is used to generate a new “memorymodule” through model forward inference to replace the old “memorymodule.”

In some embodiments, If the model is not pruned and quantized, a smallamount of data may be expanded using the data expansion method. Thus,some parameters of the new model may be updated using thebackpropagation.

The detection method of embodiments of the present disclosure may bedescribed in detail above. In the solution, the initial model may becreated based on the multi-task full-metric learning. When the model ismigrated, the memory module of the model may be updated with a smallamount of sample data to cause the model to quickly adapt to the newapplication scene. Compared to the existing technology, the method mayhave the following advantages. Based on a full-metric decodingmechanism, a final prediction result of the detection model may be onlyrelated to the metric calculation result between the depth featureinformation of the to-be-detected image and the memory featureinformation. Thus, the memory feature set may be strongly related to thespecific scene, and other parts of the model may be weakly related tothe scene. Therefore, the model may be updated by replacing the memoryfeature set of the model with a small amount of labeled samples (e.g.,tens to hundreds). When the memory module is updated, the model may beupdated based on the replacement of the prototype vectors. Thus, theupdating process of the model may not require a large amount ofiteration, and adaption and update may be completed in several minutes.Since the model is updated only depending on forwarding inference, theloss function may not need to be created, and the gradient may not becalculated, which is suitable for the quantized model. Thus, the modelmay not depend on the backpropagation when being updated.

In some other embodiments of the present disclosure, FIG. 3 illustratesa schematic structural diagram of a detection device 30 according toembodiments of the present disclosure. As shown in FIG. 3 , thedetection device 30 includes an acquisition unit 301 and an updatingunit 302.

The acquisition unit 301 may be configured to obtain the to-be-detectedmodel. The to-be-migrated model may include a memory feature set, andthe memory feature may be adapted to the application scene correspondingto the to-be-migrated model.

The updating unit 302 may be configured to perform the metriccalculation on at least one piece of sample data of the target scene andthe memory feature set to obtain at least one metric calculation result,and update the memory feature set according to the at least one metriccalculation result to obtain the target feature set that adapts to thetarget application scene, and replacing the memory feature set of theto-be-migrated model by using the target memory feature to obtain thetarget detection model.

In some embodiments, as shown in FIG. 3 , the detection device 30 mayfurther include a calculation unit 303 and a determination unit 304.

The acquisition unit 301 may be further configured to obtain theto-be-migrated image.

The calculation unit 303 may be configured to perform the metriccalculation on the to-be-detected image and the target memory featureset by using the target detection model to obtain the target metriccalculation result.

The determination unit 304 may be configured to determine the targetdetection result according to the target metric calculation result. Thetarget memory feature set may include at least one piece of memoryfeature information.

In some embodiments, the calculation unit 303 may be configured toperform feature extraction on the to-be-detected image to obtain atleast one piece of depth feature information and perform the metriccalculation on at least one piece of depth feature information and atleast one piece of memory feature information to obtain the targetmetric calculation result.

In some embodiments, the determination unit 304 may be configured toperform decoding processing on the target metric calculation result theto obtain the target detection result of the to-be-detected image.

In some embodiments, the acquisition unit 301 may be further configuredto determine the target scene, obtain at least one piece of initialsample data of the target scene according to the target scene, andperform labeling processing on the at least one piece of initial sampledata to obtain at least one piece of sample data of the target scene.

In some embodiments, the to-be-migrated model may include a memorymodule. The memory module may store the memory feature set. Theacquisition unit 301 may be further configured to obtain an initialtraining set. The initial training set may include training samplescorresponding to a plurality of tasks.

The updating unit 302 may be further configured to perform modeltraining according to the initial training set to create the initialmodel including the memory module, obtain the real image data, andperform a model adjustment on the initial model using the real imagedata to obtain the to-be-migrated model.

In some embodiments, obtaining the initial training set, and performingthe model training according to the initial training set to create theinitial model including the memory module may be performed on the clouddevice.

In some embodiments, the updating unit 302 may be further configured toperform the data expansion on the at least one piece of sample data ofthe target scene to obtain the expanded dataset when the to-be-migratedmodel is not pruned and quantized, and perform the backpropagationtraining on the to-be-migrated model using the expanded dataset toupdate the model parameters of the to-be-migrated model except thememory feature set.

In some embodiments, a “unit” may be a part of a circuit, a part of aprocessor, a part of a program or software, etc., and may also be amodule and may be non-modular. Moreover, components in embodiments ofthe present disclosure may be integrated into one processing unit, oreach unit may exist physically alone, or two or more units may beintegrated into one unit. The above-mentioned integrated unit may beimplemented in the form of hardware, or can be implemented in the formof software function modules.

If the integrated unit is implemented in the form of the softwarefunction module and is not sold or used as an independent product, theintegrated unit may be stored in a computer-readable storage medium.Thus, the essence of the technical solution of embodiments of thepresent disclosure or the part of the technical solution thatcontributes to the existing technology or all or a part of the technicalsolution may be implemented in the form of a software product. Thecomputer software product may be stored in a storage medium and includeseveral instructions to cause the computer apparatus (e.g., a personalcomputer, a server, or a network device) or a processor to perform allor a part of the method of embodiments of the present disclosure. Thestorage medium may include a U drive, a mobile hard drive, a read-onlymemory (ROM), a random access memory (RAM), magnetic disk, optical disk,or another medium that can store program codes.

Therefore, embodiments of the present disclosure provide a computerstorage medium. The computer storage medium may store a computer programand, when the computer program is executed by a plurality of processors,causes the processors to implement the steps of the method ofembodiments of the present disclosure.

Based on the composition of the detection apparatus 30 and the computerstorage medium described above, FIG. 4 illustrates a structural diagramshowing hardware of an electronic device 40 according to embodiments ofthe present disclosure. As shown in FIG. 4 , the electronic device 40includes a communication interface 401, a memory 402, and a processor403. The assemblies may be coupled together through a bus device 404.The bus device 404 may be configured to implement the connection andcommunication between these assemblies. In addition to the data bus, thebus device 404 may also include a power bus, a control bus, and a statussignal bus. However, for clarity, the various buses are labeled as busdevice 404 in FIG. 4 . Among them, the communication interface 401 maybe configured to receive and send signals in the process of sending andreceiving information with other external network elements.

The memory 402 may be used to store the computer program that can beexecuted by the processor 403.

The processor 403 may be configured to, when the computer program isexecuted, obtain the to-be-migrated model, the to-be-migrated modelincluding a memory feature set, and the memory feature set representinga feature vector set associated with the application scene correspondingto the to-be-migrated model, perform the metric calculation on the atleast one piece of sample data of the target scene and the memoryfeature set to obtain the at least one metric calculation result, updatethe memory feature set according to the at least one metric calculationresult to obtain the target memory feature set, the target memoryfeature set representing the feature vector set associated with thetarget scene, and obtain the target detection model by replacing thememory feature set in the to-be-migrated model with the target memoryfeature set.

The memory 402 of embodiments of the present disclosure may be avolatile memory or a non-volatile memory, or may include both volatileand non-volatile memory. The non-volatile memory may be a read-onlymemory (ROM), a programmable read-only memory (ROM), an erasableprogrammable read-only memory (EPROM), an electrically erasableprogrammable read-only memory (EEPROM), or a flash memory. The volatilememory may be a random access memory (RAM), which is used as an externalcache. By way of example and not limitation, many forms of RAM may beavailable, such as a static RAM (SRAM), a dynamic RAM (DRAM), asynchronous DRAM (SDRAM), a double data rate synchronous dynamic randomaccess memory (DDRSDRAM), an enhanced synchronous dynamic random accessmemory (ESDRAM), a synchronous link dynamic random access memory(SLDRAM), and a direct rambus RAM (DRRAM). The memory 402 of the systemsand methods described herein may be intended to include, but not belimited to, these and any other suitable types of memory.

The processor 403 may be an integrated circuit chip with signalprocessing capability. In an implementation process, the steps of theabove-mentioned method may be completed by an integrated logic circuitof hardware in the processor 403 or an instruction in the form ofsoftware. The processor 403 may be a general-purpose processor, adigital signal processor (DSP), an application-specific integratedcircuit (ASIC), a field programmable gate array (FPGA), or anotherprogrammable logic device, a discrete gate or transistor logic device,and a discrete hardware component. The methods, steps, and logic blockdiagrams disclosed in embodiments of the present disclosure may beimplemented or executed. A general-purpose processor may be amicroprocessor or the processor may be any conventional processor or thelike. The steps of the method disclosed in connection with embodimentsof the present disclosure may be directly embodied as executed by ahardware decoding processor, or executed by a combination of hardwareand software modules in the decoding processor. The software modules maybe located in a random-access memory, a flash memory, a read-onlymemory, a programmable read-only memory, or an electrically erasableprogrammable memory, a register, and another storage medium known in theexisting technology. The storage medium may be located in the memory402, and the processor 403 may be configured to read the information inthe memory 402 and complete the steps of the above method in connectionwith the hardware.

Embodiments of the present disclosure may be implemented in hardware,software, firmware, middleware, microcode, or a combination thereof. Forhardware implementation, the processing unit may be implemented in oneor more of an application-specific integrated circuit (ASIC), a digitalsignal processing (DSP), a digital signal processing device (DSPD), aprogrammable logic device (PLD), a field-programmable gate array (FPGA),a general purpose processor, a controller, a microcontroller, amicroprocessor, and another electronic unit configured to perform thefunctions of the present disclosure, or a combination thereof.

For a software implementation, the technology may be implemented throughmodules (e.g., procedures, functions, etc.) that perform the functionsof the present disclosure. Software codes may be stored in memory andexecuted by the processor. The memory can be implemented in theprocessor or external to the processor.

In some embodiments, the processor 403 may be further configured toexecute the steps of the method of embodiments of the present disclosurewhen the computer program is executed.

In some other embodiments of the present disclosure, based on theabove-mentioned schematic diagram of the composition of the modeldetection device 30, FIG. 5 illustrates a schematic structural diagramof an electronic device 40 according to embodiments of the presentdisclosure. As shown in FIG. 5 , the electronic device 40 includes atleast the detection device 30 of embodiments of the present disclosure.

Since the electronic device 40 includes the detection device 30, whenthe to-be-migrated model is migrated to the target scene, based on themetric calculation between the features, update and replacement may beperformed on the memory feature set of the to-be-migrated model usingthe sample data of the target scene. Thus, the updated target memoryfeature set may adapt to the target scene. Therefore, the to-be-migratedmodel may be updated and migrated with a small amount of sample data,which has a faster updating speed and saves time and labor costs. Inaddition, the method may be suitable for the migration and update of themodel that is pruned and quantized. The method may be broadly applied.

The above are only preferred embodiments of the present disclosure andare not intended to limit the protection scope of the presentdisclosure.

In the present disclosure, the terms “comprising,” “including,” or anyother variation thereof are intended to encompass non-exclusiveinclusion, such that a process, method, article, or device comprising aseries of elements includes not only those elements, but also otherelements not expressly listed or inherent to such a process, method,article or apparatus. Without further limitation, an element defined bythe phrase “comprising a . . .” does not preclude the presence ofadditional identical elements in a process, method, article, orapparatus that includes the element.

The above-mentioned numbers of embodiments of the present disclosure areonly for description and do not represent the advantages ordisadvantages of embodiments of the present disclosure.

The methods disclosed in method embodiments of the present disclosurecan be arbitrarily combined without conflict to obtain new methodembodiments.

The features disclosed in product embodiments of the present disclosuremay be combined arbitrarily without conflict to obtain new productembodiments.

The features disclosed in method or device embodiments of the presentdisclosure may be combined arbitrarily without conflict to obtain newmethod embodiments or device embodiments.

The above are only some embodiments of the present disclosure, but theprotection scope of the present disclosure is not limited to this. Thoseskilled in the art may easily think of modifications or replacements inthe technical scope of the present disclosure. These modifications andreplacements should be within the scope of the present disclosure. Thus,the scope of the present application should be subject to the scope ofthe claims.

What is claimed is:
 1. A detection method comprising: obtaining ato-be-migrated model, the to-be-migrated model including a memoryfeature set, and the memory feature set representing a feature vectorset associated with an application scene corresponding to theto-be-migrated model; performing metric calculation on at least onepiece of sample data of a target scene and the memory feature set toobtain at least one metric calculation result; updating the memoryfeature set according to the at least one metric calculation result toobtain a target memory feature set, the target memory feature setrepresenting a feature vector set associated with the target scene; andobtaining a target detection model by replacing the memory feature setof the to-be-migrated model with the target memory feature set.
 2. Themethod of claim 1, further comprising: obtaining a to-be-detected image;performing metric calculation on the to-be-detected image and the targetmemory feature set using the target detection model to obtain a targetmetric calculation result; and determining a target detection resultaccording to the target metric calculation result, the target memoryfeature set including at least one piece of memory feature information.3. The method according to claim 2, wherein performing the metriccalculation on the to-be-detected image and the target memory featureset using the target detection model to obtain the target metriccalculation result includes: performing feature extraction on theto-be-detected image to obtain at least one piece of depth featureinformation; and performing the metric calculation on the at least onepiece of depth feature information and the at least one piece of memoryfeature information to obtain the target metric calculation result. 4.The method according to claim 2, wherein determining the targetdetection result according to the target metric calculation resultincludes: performing decoding processing on the target metriccalculation result to obtain the target detection result of theto-be-detected image.
 5. The method according to claim 1, furthercomprising, before performing the metric calculation on the at least onepiece of sample data of the target scene and the memory feature set:determining the target scene; obtaining at least one piece of initialsample data of the target scene according to the target scene; andperforming labeling processing on the at least one piece of initialsample data to obtain the at least one piece of sample data of thetarget scene.
 6. The method according to claim 1, wherein theto-be-migrated model includes a memory module, and the memory modulestores the memory feature set; the method further comprising: obtainingan initial training set, the initial training set including trainingsamples corresponding to a plurality of tasks; performing model trainingaccording to the initial training set to create an initial modelincluding the memory module; and obtaining real image data to performmodel adjustment on the initial model using the real image data toobtain the to-be-migrated model.
 7. The method according to claim 1,further comprising: in response to the to-be-migrated model not beingpruned and quantized, performing data expansion on at least one piece ofsample data of the target scene to expand a data set; and performingbackpropagation training on the to-be-migrated model using the expandeddata set to update a model parameter of the to-be-migrated model exceptfor the memory feature set.
 8. An electronic device comprising: a memorystoring a computer program; and a processor coupled with the memory and,when the computer program is executed, configured to: obtain ato-be-migrated model, the to-be-migrated model including a memoryfeature set, and the memory feature set representing a feature vectorset associated with an application scene corresponding to theto-be-migrated model; perform metric calculation on at least one pieceof sample data of a target scene and the memory feature set to obtain atleast one metric calculation result; update the memory feature setaccording to the at least one metric calculation result to obtain atarget memory feature set, the target memory feature set representing afeature vector set associated with the target scene; and obtain a targetdetection model by replacing the memory feature set of theto-be-migrated model with the target memory feature set.
 9. The deviceaccording to claim 8, wherein the processor is further configured to:obtain a to-be-detected image; perform the metric calculation on theto-be-detected image and the target memory feature set using the targetdetection model to obtain a target metric calculation result; anddetermine a target detection result according to the target metriccalculation result, the target memory feature set including at least onepiece of memory feature information.
 10. The device according to claim9, wherein the processor is further configured to: perform featureextraction on the to-be-detected image to obtain at least one piece ofdepth feature information; and perform the metric calculation on the atleast one piece of depth feature information and the at least one pieceof memory feature information to obtain the target metric calculationresult.
 11. The device according to claim 9, wherein the processor isfurther configured to: perform decoding processing on the target metriccalculation result to obtain the target detection result of theto-be-detected image.
 12. The device according to claim 8, wherein theprocessor is further configured to: determine the target scene; obtainat least one piece if initial sample data of the target scene accordingto the target scene; and perform labeling processing on the at least onepiece of initial sample data to obtain the at least one piece of sampledata of the target scene.
 13. The device according to claim 8, wherein:the to-be-migrated model includes a memory module, and the memory modulestores the memory feature set; and the processor is further configuredto: obtain an initial training set, the initial training set includingtraining samples corresponding to a plurality of tasks; perform modeltraining according to the initial training set to creating an initialmodel including the memory module; and obtain real image data to performmodel adjustment on the initial model using the real image data toobtain the to-be-migrated model.
 14. The device according to claim 8,wherein the processor is further configured to: in response to theto-be-migrated model not being pruned and quantized, perform dataexpansion on at least one piece of sample data of the target scene toexpand a data set; and perform backpropagation training on theto-be-migrated model using the expanded data set to update a modelparameter of the to-be-migrated model except for the memory feature set.15. A non-transitory computer storage medium storing a computer programand, when executed by a processor, causes the processor to: obtain ato-be-migrated model, the to-be-migrated model including a memoryfeature set, and the memory feature set representing a feature vectorset associated with an application scene corresponding to theto-be-migrated model; perform a metric calculation on at least one pieceof sample data of a target scene and the memory feature set to obtain atleast one metric calculation result; update the memory feature setaccording to the at least one metric calculation result to obtain atarget memory feature set, the target memory feature set representing afeature vector set associated with the target scene; and obtain a targetdetection model by replacing the memory feature set of theto-be-migrated model with the target memory feature set.
 16. The storagemedium according to claim 15, wherein the processor is furtherconfigured to: obtain a to-be-detected image; perform the metriccalculation on the to-be-detected image and the target memory featureset using the target detection model to obtain a target metriccalculation result; and determine a target detection result according tothe target metric calculation result, the target memory feature setincluding at least one piece of memory feature information.
 17. Thestorage medium according to claim 16, wherein the processor is furtherconfigured to: perform feature extraction on the to-be-detected image toobtain at least one piece of depth feature information; and perform themetric calculation on the at least one piece of depth featureinformation and the at least one piece of memory feature information toobtain the target metric calculation result.
 18. The storage mediumaccording to claim 16, wherein the processor is further configured to:perform decoding processing on the target metric calculation result toobtain the target detection result of the to-be-detected image.
 19. Thestorage medium according to claim 15, wherein the processor is furtherconfigured to: determine the target scene; obtain at least one piece ofinitial sample data of the target scene according to the target scene;and perform labeling processing on the at least one piece of initialsample data to obtain the at least one piece of sample data of thetarget scene.
 20. The storage medium according to claim 15, wherein: theto-be-migrated model includes a memory module, and the memory modulestores the memory feature set; and the processor is further configuredto: obtain an initial training set, the initial training set includingtraining samples corresponding to a plurality of tasks; perform modeltraining according to the initial training set to create an initialmodel including the memory module; and obtain real image data to performa model adjustment on the initial model using the real image data toobtain the to-be-migrated model.